package com.yuzhyn.hiops.app.application.service;

import com.yuzhyn.hiops.common.entity.SysMachineStatusLog;
import com.yuzhyn.hiops.common.mapper.SysMachineStatusLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Slf4j
@Service
public class TestService {

    @Autowired
    SysMachineStatusLogMapper sysMachineStatusLogMapper;

    public void gca() {
            log.info("查询 1 个数据集合");
            List<SysMachineStatusLog> logs = sysMachineStatusLogMapper.selectList(null);
            logs = null;
    }

    public void gctest() {
        for (int times = 0; times < 100; times++) {
            log.info("查询第 " + times + " 个数据集合");
            List<SysMachineStatusLog> logs = sysMachineStatusLogMapper.selectList(null);
            logs = null;
        }
    }

    public void gctestloop() {
        for (int times = 0; times < 100; times++) {
            log.info("查询第 " + times + " 个数据集合处理");
            List<String> filters = Arrays.asList("ab", "cd", "ef");
            List<SysMachineStatusLog> logs = sysMachineStatusLogMapper.selectList(null);
            for (SysMachineStatusLog item : logs) {
                for (String s : filters) {
                    if (item.getId().contains(s)) {
                        boolean check = true;
                    }
                }
            }
        }
    }
}
